<template>
  <div class="left-nav">
      <div class="nav-container">
          <div class="nav-title">
            <span>
              <i class="el-icon-menu"></i>
              <span>菜单列表</span>
            </span>   
          </div>
          <el-menu default-active="1" class="el-menu-vartical-demo" style="height: 92.5%;overflow-y: auto;overflow-x: hidden;">
              <el-submenu v-for="item in memu" :key="item.index" :index="item.index">
                <template slot="title">
                  <i :class="item.icon"></i>
                  <span v-html="item.title"></span>
                </template>
                <el-menu-item class="menu-cell" v-for="oitem in item.children" :key="oitem.index" @click="handleMenu(oitem.label,oitem.router)" :index="oitem.index">
                  <i class="el-icon-location"></i>
                  <span v-html="oitem.label"></span>
                </el-menu-item>
              </el-submenu>
          </el-menu>
      </div>
  </div>
</template>

<script>
const menu_chinese = [
    {
       title:"会员管理",
       name:"member_management",
       icon:"el-icon-tickets",
       index:"1",
       children:[
          {label:"新增会员",index:"1-1",router:{path:"/member/addMember",name:"addMember"}},
          {label:"会员账户信息",index:"1-2",router:{path:"/member/memberInfo",name:"memberInfo"}},
          {label:"全部会员管理",index:"1-3",router:{path:"/member/manageMember",name:"manageMember"}}
       ]
    },
    {
      title:"商户管理",
      name:"shop_management",
      icon:"el-icon-tickets",
      index:"6",
      children:[
        {label:"全部商户",index:"6-1",router:{path:"/shop/shopInfo",name:"shopInfo"}},
        // {label:"终端查询",index:"6-2",router:{path:"/shop/terminalInfo",name:"terminalInfo"}},
        {label:"添加商户",index:"6-3",router:{path:"/shop/addShop",name:"addShop"}},
        {label:"门店管理",index:"6-5",router:{path:"/shop/subbranchInfo",name:"subbranchInfo"}},
        {label:"商户通道信息同步",index:"6-6",router:{path:"/shop/shopChannelList",name:"shopChannelList"}},
      ]
    },
    {
      title:"台码管理",
      name:"paymentcode_management",
      icon:"el-icon-tickets",
      index:"7",
      children:[
        {label:"全部台码",index:"7-1",router:{path:"/qrcode/addCode",name:"addCode"}},
        {label:"台码管理",index:"7-2",router:{path:"/qrcode/manageCode",name:"manageCode"}},
        {label:"代理切换",index:"7-3",router:{path:"/qrcode/switchAgent",name:"switchAgent"}},
        
      ]
    },
    {
       title:"交易管理",
       name:"trading_desk",
       icon:"el-icon-tickets",
       index:"2",
       children:[
          {label:"交易汇总",index:"2-1",router:{path:"/trading/tradingDashboard",name:"tradingDashboard"}},
          {label:"无卡交易",index:"2-2",router:{path:"/trading/tradingInfo",name:"tradingInfo"}},
          {label:"提现信息",index:"2-8",router:{path:"/trading/withdrawInfo",name:"withdrawInfo"}},
          {label:"扫码交易",index:"2-3",router:{path:"/trading/QRcodeInfo",name:"QRcodeInfo"}},
          {label:"无卡分润信息",index:"2-4",router:{path:"/trading/benefitInfo",name:"benefitInfo"}},
          {label:"商户代理分润",index:"2-5",router:{path:"/trading/rebateDetail",name:"rebateDetail"}},
          {label:"通道信息",index:"2-6",router:{path:"/trading/channelInfo",name:"channelInfo"}},
          {label:"信息推送",index:"2-7",router:{path:"/trading/publishMessage",name:"publishMessage"}},
       ]
    },
    {
       title:"贴牌管理",
       name:"brand_management",
       icon:"el-icon-tickets",
       index:"3",
       children:[
          {label:"新增品牌",index:"3-1",router:{path:"/brand/addBrand",name:"addBrand"}},
          {label:"新增渠道",index:"3-11",router:{path:"/brand/addChannel",name:"addChannel"}},
          {label:"渠道管理",index:"3-10",router:{path:"/brand/channelManage",name:"channelManage"}},
          {label:"品牌切换",index:"3-2",router:{path:"/brand/toggleBrand",name:"toggleBrand"}},
          {label:"账号注销",index:"3-3",router:{path:"/brand/cancelAccount",name:"cancelAccount"}},
          {label:"路由切换",index:"3-4",router:{path:"/brand/toggleRouter",name:"toggleRouter"}},
          {label:"版本管理",index:"3-5",router:{path:"/brand/manageVersions",name:"manageVersions"}},
          {label:"设置通道公共费率",index:"3-6",router:{path:"/brand/setBrandRate",name:"setBrandRate"}},
          {label:"设置第三方公共费率",index:"3-7",router:{path:"/brand/setThirdpartyRate",name:"setThirdpartyRate"}},
          {label:"400客服电话修改",index:"3-8",router:{path:"/brand/customerServices",name:"customerServices"}},
          {label:"广告投放",index:"3-9",router:{path:"/brand/manageAdvertising",name:"manageAdvertising"}},
       ]
    },
    {
       title:"通道管理",
       name:"channel_management",
       icon:"el-icon-tickets",
       index:"8",
       children:[
           {label:"通道商户",index:"8-1",router:{path:"/channel/channelShopList",name:"channelShopList"}},
       ]
    },
    {
       title:"认证管理",
       name:"identification_management",
       icon:"el-icon-tickets",
       index:"4",
       children:[
           {label:"审核列表",index:"4-4",router:{path:"/identify/authInfo",name:"authInfo"}},
          {label:"实名认证",index:"4-1",router:{path:"/identify/authRealname",name:"authRealname"}},
          {label:"实名审核",index:"4-2",router:{path:"/identify/checkRealname",name:"checkRealname"}},
          // {label:"商户审核",index:"4-3",router:{path:"/identify/checkShop",name:"checkShop"}},
          {label:"商户审核",index:"4-3",router:{path:"/shop/shopAuth",name:"shopAuth"}}
       ]
    },
    {
       title:"权限管理",
       name:"authority_management",
       icon:"el-icon-tickets",
       index:"5",
       children:[
          {label:"黑名单管理",index:"5-1",router:{path:"/auth/manageBlacklist",name:"manageBlacklist"}},
          {label:"角色权限设置",index:"5-2",router:{path:"/auth/setRolePermission",name:"setRolePermission"}}
       ]
    }
]

import {mapActions} from "vuex";
export default {
  name:'Left-nav',
  data () {
    return {
        memu : []
    };
  },
  components: {},
  created() {
    let role = sessionStorage.getItem('5') || 5 ;
    if(role==="4"){
       this.memu = menu_chinese.filter(item=>{
         if(item.name === "identification_management"){
           return item;
         }     
       })
    }else{
      this.memu = menu_chinese;
    }
  },
  mounted() {},
  methods: {
    ...mapActions(["_setSystemStatus"]),
    handleMenu(label,router){
      this._setSystemStatus({attr:"currentRouter",value:label});
      this.$router.push({name:router.name});
    }
  }
}

</script>
<style scoped>
  .left-nav,.nav-container{
     width: 100%;
      height: 100%;
      box-sizing: border-box;
      overflow: hidden;
      background-color: #F2F9FD; 
  }
  .left-nav{
    border-right:1px solid #b5cfc9;
  }
  .nav-title{
    height: 50px;
    width: 100%;
    background-color: #F2F9FD;
    color: #1280BB;
    display: flex;
    justify-content: center;
    align-items: center;
    
  }
  .menu-cell{
    padding-left:20px !important;
  }
 
/* .menu-cell:nth-child(1){
  border-top: 1px solid #eedded;
}*/
.menu-cell:last-child{
  border-bottom: 1px solid #eedded;
} 
</style>